package com.yutian.example.demo.web.forum.controller;

import com.yutian.example.demo.forum.dao.model.Topic;
import com.yutian.example.demo.service.forum.ITopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/topic")
public class TopicController {

    @Autowired
    private ITopicService topicService;

    @GetMapping("/get")
    public Topic get(Long id){
        return topicService.get(id);
    }

    @PostMapping("/insert")
    public Topic insert(String title, String msg){
        //创建一个主帖
        return topicService.insert(title, msg);
    }
}
